package atlub.twitter;

import twitter4j.TwitterStream;
import twitter4j.TwitterStreamFactory;
import twitter4j.conf.ConfigurationBuilder;

/**
 * Hold one single credential
 * @author bliu1
 */
public class TwitterAgent {
	
	ConfigurationBuilder cb;
	
	public TwitterAgent(String[] credentials){
		cb = new ConfigurationBuilder();
		cb.setDebugEnabled(true);
	    cb.setOAuthConsumerKey(credentials[0]);
	    cb.setOAuthConsumerSecret(credentials[1]);
	    cb.setOAuthAccessToken(credentials[2]);
	    cb.setOAuthAccessTokenSecret(credentials[3]);
	}
	public TwitterAgent(
			String oAuthConsumerKey, String oAuthConsumerSecret, 
			String oAuthAccessToken, String oAuthAccessTokenSecret){
		cb = new ConfigurationBuilder();
		cb.setDebugEnabled(true);
	    cb.setOAuthConsumerKey(oAuthConsumerKey);
	    cb.setOAuthConsumerSecret(oAuthConsumerSecret);
	    cb.setOAuthAccessToken(oAuthAccessToken);
	    cb.setOAuthAccessTokenSecret(oAuthAccessTokenSecret);
	}
	
	public TwitterStream getTwitterStream(){
		return new TwitterStreamFactory(cb.build()).getInstance();
	}
}
